package com.hanbang.gycatering.scaleview;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/*
 * bug:  当多点触摸时pointerIndex out of range异常
 * 			当viewpager里面的控件可以多点触摸时会导致
 * 		这里修改了当是多点时   viewpager就不响应   给子控件相应
 */
public class BrowseImageViewPager extends ViewPager {

	public BrowseImageViewPager(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public BrowseImageViewPager(Context context) {
		super(context);
	}

	@Override
	public boolean onInterceptTouchEvent(MotionEvent ev) {
		// the incorrect array size will only happen in the multi-touch
		// scenario.
		// if (ev.getPointerCount() > 1 && mIsDisallowIntercept) {
		// requestDisallowInterceptTouchEvent(false);
		// boolean handled = super.dispatchTouchEvent(ev);
		// requestDisallowInterceptTouchEvent(true);
		// return handled;
		// } else {
		// return super.dispatchTouchEvent(ev);
		// }
		try {
			return super.onInterceptTouchEvent(ev);
		} catch (IllegalArgumentException e) {
			// 不理会
			return false;
		} catch (ArrayIndexOutOfBoundsException e) {
			// 不理会
			return false;
		}
	}

}
